package com.xinghanlaser.applet;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 *
 * <p>
 *
 * @author: mftuo 陀铭峰
 * @since: 2024/5/31 14:25
 */
@Getter
@AllArgsConstructor
public enum LoginTypeB {
    CODE(1, "验证码") {
        @Override
        void action() {
            System.out.println("验证码登录...");
        }
    },
    PASSWORD(2, "密码") {
        @Override
        void action() {
            System.out.println("密码登录...");
        }
    };

    private final Integer type;

    private final String desc;

    abstract void action();

    public static LoginTypeB getByType(Integer type){
        return Arrays.stream(LoginTypeB.values())
                .filter(item -> item.getType().equals(type))
                .findFirst()
                .orElse(null);
    }
}
